from django.db import models
from django.contrib.auth.models import AbstractUser


class User(AbstractUser):
    phone = models.CharField(max_length=11, unique=True, db_index=True)

    class Meta:
        db_table = 'users'


class UserInfo(models.Model):
    user = models.OneToOneField('user', on_delete=True)
    # 职位
    post = models.CharField(max_length=100, null=True)
    sex = models.CharField(max_length=2, null=True)
    age = models.IntegerField(null=True)
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    class Meta:
        db_table = 'user_infos'
